package com.cnhis.cloudhealth.clinical.clidoctor.clidiseasereference.bo;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cnhis.cloudhealth.clinical.clidoctor.clidiseasereference.dao.CliDiseaseReferenceDao;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import com.cnhis.cloudhealth.commons.utils.Page;
import com.cnhis.cloudhealth.commons.utils.StaticKeys;

@Service
public class CliDiseaseReferenceBo {
	@Resource
	private CliDiseaseReferenceDao cliDiseaseReferenceDao;
	
	public ModelVo diseaseTree(Map map)throws Exception{
		ModelVo mo = new ModelVo();
		List ls=null;
		try {
			ls = cliDiseaseReferenceDao.diseaseTree(map);
			
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		mo.setMap(map);
		mo.setResult(StaticKeys.OH_SUCCESS);
		mo.setList(ls);
		mo.setRows(ls);
		return mo;
	}
	public ModelVo diseaseReferenceContent(Map map)throws Exception{
		ModelVo mo = new ModelVo();
		List ls=null;
		try {
			ls = cliDiseaseReferenceDao.diseaseReferenceContent(map);
			
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		mo.setMap(map);
		mo.setResult(StaticKeys.OH_SUCCESS);
		mo.setList(ls);
		mo.setRows(ls);
		return mo;
	}
	public ModelVo directorySearch(Map map,int currPage,int pageSize)throws Exception{
		ModelVo mo = new ModelVo();
		Page pg=null;
		try {
			pg = cliDiseaseReferenceDao.directorySearch(map,currPage,pageSize);
			
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		mo.setMap(map);
		mo.setResult(StaticKeys.OH_SUCCESS);
		mo.setList(pg.getList());
		mo.setRows(pg.getList());
		return mo;
	}
}
